package logic.objects;

public class Connection {
	private Node node1;
	private Node node2;
	private Double pheromon;
	private boolean dummyConnection;
	private Double length;
	private Double heuristicalValue;

	public Connection() {
		dummyConnection = true;
	}

	public Connection(Node node1, Node node2) {
		this.node1 = node1;
		this.node2 = node2;
		length = Math
				.sqrt(((node1.getX() - node2.getX()) * (node1.getX() - node2
						.getX()))
						+ ((node1.getY() - node2.getY()) * (node1.getY() - node2
								.getY())));
		dummyConnection = false;
	}

	public Node getNode1() {
		return node1;
	}

	public void setNode1(Node node1) {
		this.node1 = node1;
	}

	public Node getNode2() {
		return node2;
	}

	public void setNode2(Node node2) {
		this.node2 = node2;
	}

	public Double getPheromon() {
		if (pheromon != null)
			return pheromon;
		else
			return 0.0;
	}

	public void setPheromon(Double pheromon) {
		this.pheromon = pheromon;
	}

	public void setPheromon(int pheromon) {
		this.pheromon = pheromon * 1.0;
	}

	public boolean isDummy() {
		return dummyConnection;
	}

	public Double getLength() {
		return length;
	}

	public Double getHeuristicalValue() {
		if (heuristicalValue != null)
			return heuristicalValue;
		else
			return 0.0;
	}

	public void setHeuristicalValue(Double heuristicalValue) {
		this.heuristicalValue = heuristicalValue;
	}
}
